﻿using Ace.IdStrategy;
using Chloe.Admin.Common.Tree;
using Chloe.Application.Interfaces;
using Chloe.Application.Models.Member;
using Chloe.Entities;
using Chloe.Admin.Common;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Chloe.Application.Interfaces.Bike;

namespace Chloe.Admin.Areas.BikeClub.Controllers
{
    [LoginAuthorizeAttribute]
    public class MemberController : WebController
    {
        // GET: BikeClub/Member
        public ActionResult Index()
        {
            return View();
        }

        [HttpGet]
        public ActionResult GetModels(string keyword)
        {
            List<Bike_Member> data = this.CreateService<IMemberAppService>().GetMembers(keyword);
            return this.SuccessData(data);
        }

        [HttpPost]
        //[ValidateAntiForgeryToken]
        public ActionResult Add(AddMemberInput input)
        {
            this.CreateService<IMemberAppService>().Add(input);
            return this.AddSuccessMsg();
        }
        [HttpPost]
        //[ValidateAntiForgeryToken]
        public ActionResult Update(UpdateMemberInput input)
        {
            this.CreateService<IMemberAppService>().Update(input);
            return this.UpdateSuccessMsg();
        }

        [HttpPost]
        //[ValidateAntiForgeryToken]
        public ActionResult Delete(string id)
        {
            this.CreateService<IMemberAppService>().Delete(id);
            return this.DeleteSuccessMsg();
        }
    }
}